//
//  baseNavigationController.swift
//  SinaWeiBo
//
//  Created by dengchen on 15/11/17.
//  Copyright © 2015年 name. All rights reserved.
//

import UIKit

class baseNavigationController: UINavigationController {

    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        if childViewControllers.count > 0 {
            viewController.navigationItem.backBarButtonItem = UIBarButtonItem(title: "返回", style: .Plain, target: self , action: "back")
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    @objc private func back() {
        self.popViewControllerAnimated(true)
    }
}
